FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app

FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY ApiService/ApiService.csproj ApiService/
RUN dotnet restore ApiService/ApiService.csproj
COPY . .
WORKDIR /src/ApiService
RUN dotnet build ApiService.csproj -c Release -o /app

FROM build AS publish
RUN dotnet publish ApiService.csproj -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "ApiService.dll"]
